package com.xma.springcloud.contrller;

import com.xma.springcloud.common.ResponseResult;
import com.xma.springcloud.entity.Payment;
import com.xma.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: arthur
 * @License: (C) Copyright 2020-2028, xxx Corporation Limited.
 * @Contact: 413911174@qq.com
 * @Date: 2020/6/26 16:28
 * @Version: 1.0
 * @Description:
 */
@RestController
@Slf4j
@RequestMapping("/consumer")
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/payment/get/{id}")
    public ResponseResult<Payment> selectOne(@PathVariable("id") Long id) {
        return  paymentFeignService.queryById(id);
    }
    @GetMapping(value = "/payment/feign/timeout")
    public String paymentFeignTimeOut(){
        // openfeign-ribbon  客户端一半默认等待一秒钟
        return paymentFeignService.paymentFeignTimeOut();
    }

}
